package cn.geminis.data.jpa.graphql.entity;

import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import javax.persistence.*;
import java.util.UUID;

@Entity
@Getter
@Setter
public class LevelOneData {

    @Id
    @Column(length = 36)
    private String id;

    @Lob
    private byte[] lazyData;

    @Lob
    private byte[] lazyData2;

    @PrePersist
    void createId() {
        if (StringUtils.isEmpty(this.id)) {
            this.id = UUID.randomUUID().toString();
        }
    }
}
